<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<!doctype html>
<html>
    <head>
        <c:import url="html_head.jsp" />
        <title>Evidence příjmů a výdajů</title>
    </head>
    <body>
        <c:import url="page_head.jsp" />
        <div class="container">
            <div class="body">
                <p id="old-browser" class="message warning hidden">Používáte zastaralý internetový prohlížeč, a některé funkce této aplikace mohou proto být nepřístupné. Aktualizujte prosím svůj internetový prohlížeč.</p>
                <c:import url="notifications.jsp" />
                <form action="save" method="post">
                    <table>
                        <thead>
                            <tr>
                                <th class="w30">Jméno</th>
                                <th class="w20">IČO</th>
                                <th class="w43">Číslo účtu</th>
                                <th class="w7 icons"></th>
                            </tr>
                        </thead>
                        <tbody>
                            <tr id="row-add">
                                <td colspan="6" class="center add">
                                    <a href="#" id="btn-add" class="full">Přidat položku</a>
                                </td>
                            </tr>
                            <tr id="frm-add" class="hidden">
                                <td>
                                    <input type="text" id="frm-add-name" name="name[new]" data-required="true" />
                                </td>
                                <td>
                                    <input type="text" id="frm-add-ico" name="ico[new]" />
                                </td>
                                <td>
                                    <input type="text" id="frm-add-account" name="account[new]" pattern="(\d{1,6}-)?\d{2,10}/\d{4}" data-required="true" />
                                </td>
                                <td class="icons center">
                                    <input type="image" name="send[new]" class="icon icon-add" title="Uložit" alt="Uložit" />
                                </td>
                            </tr>
                            <c:forEach items="${subjects}" var="subject">
                            <tr class="item" id="item-1" data-id="${subject.id}">
                                <td><c:out value="${subject.name}" /></td>
                                <td><c:out value="${subject.regId}" /></td>
                                <td><c:out value="${subject.accountNumber}" /></td>
                                <td class="icons center">
                                    <a href="#" class="icon icon-edit" title="Upravit"></a>
                                    <a href="delete?subject=${subject.id}" class="icon icon-del confirm" data-confirm="Opravdu chcete smazat tento záznam?" title="Smazat"></a>
                                </td>
                            </tr>
                            <tr class="hidden frm-edit" id="frm-edit-${subject.id}" data-id="${subject.id}">
                                <td>
                                    <input type="hidden" name="id[${subject.id}]" value="${subject.id}" />
                                    <input type="text" id="frm-edit-${subject.id}-name" name="name[${subject.id}]" value="${subject.name}" data-required="true" />
                                </td>
                                <td>
                                    <input type="text" id="frm-edit-${subject.id}-ico" name="regid[${subject.id}]" value="${subject.regId}" />
                                </td>
                                <td>
                                    <input type="text" id="frm-edit-${subject.id}-account" name="account[${subject.id}]" value="${subject.accountNumber}" pattern="(\d{1,6}-)?\d{2,10}/\d{4}" data-required="true" />
                                </td>
                                <td class="icons center">
                                    <input type="image" name="send[${subject.id}]" class="icon icon-add" title="Uložit" alt="Uložit" />
                                    <a href="#" class="icon icon-cancel" title="Storno"></a>
                                </td>
                            </tr>
                            </c:forEach>
                        </tbody>
                    </table>
                </form>
            </div>
        </div>
    </body>
</html>